#ifndef _INCLUDE_OPENNETWORK_I_NETWORK_CALLBACK_
#define _INCLUDE_OPENNETWORK_I_NETWORK_CALLBACK_

/*!
    Copright: Kai "DrHalan" Mast - www.freakybytes.org

    This file is part of OpenNetwork. See OpenNetwork.h for license information.
*/


#include "types.h"
#include "SNetworkAddress.h"
#include "ENetworkInformation.h"

namespace onet
{
    class INetworkPort;

    class INetworkCallback
    {
    public:
        INetworkCallback()
        {
        }

        virtual ~INetworkCallback()
        {
        }

        //! Event Callbacks
        //! ---------------------------

        //! When a peer tries to connect this function is called
        //! If it returns false the connection is denied
        virtual bool onConnectRequest(const SNetworkAddress& addr)
        {
            return true;
        }

        //! A port was created
        virtual void onCreate(const INetworkPort* port) {}

        //! The ports update/work-loop was called
        virtual void onUpdate() {}

        //! The port was destroyed
        virtual void onDestroy() {}

        //! Connection wasn't established
        virtual void onConnectionFailed(const PeerID id, const ENetworkInformation info) {}

        //! A new peer connected
        virtual void onPeerConnect(const PeerID id) {}

        //! A peer disconnected
        virtual void onPeerDisconnect(const PeerID id, const ENetworkInformation info) {}

        //! A message was received
        virtual void onMessageReceived(const PeerID id, c8 type, u16 length, c8* data, bool reliable) {}

        //!---------------------------
    };

} //!end namespace onet

#endif
